package com.crm.config;

import java.util.HashSet;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ConversionServiceFactoryBean;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.converter.Converter;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**全局转换器
 * @author SMILE
 */
@Configuration
public class GolbalConverter implements WebMvcConfigurer{

	private ConversionService getConversionService() {
		ConversionServiceFactoryBean factoryBean = new ConversionServiceFactoryBean();
		Set<Converter> converters = new HashSet<Converter>();
		//将自定义转换器添加到转换器工程容器中
		converters.add(new StringToDateConvert());
		factoryBean.setConverters(converters);
		return factoryBean.getObject();
	}
}

